//
//  NYAirlineView.m
//  NiuWaJiaoYu
//
//  Created by MinLison on 2018/1/6.
//  Copyright © 2018年 niuwaketang. All rights reserved.
//

#import "NYAirlineView.h"

#import "NYAirlineCommitRequest.h"

#import "NYAirlineCommitView.h"

@interface NYAirlineView () <NYAirlineCommitViewDelegate>


@end
@implementation NYAirlineView

- (void)setupTableView {
    
    [super setupTableView];
    self.tableView.backgroundColor = UIColorMakeWithHex(@"#F3F4F5");

    NYAirlineCommitView *headView = [[NYAirlineCommitView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, __WGHeight(199)) withDelegate:self];
    self.tableView.tableHeaderView = headView;
    self.tableView.enableAutoAdjustHeader = true;
}

#pragma mark -  NYAirlineCommitViewDelegate
- (void)submitTheQuestionToService:(NSString *)questionString {
    
    NYAirlineCommitRequest *request = [NYAirlineCommitRequest requestWithParams:@{kRequestKeyChannel:@(NYUserManager.channelID), kRequestKeyLoginCode : NOT_NULL_STRING_DEFAULT_EMPTY(NYUserManager.logincode), kRequestKeyUser_ID:NOT_NULL_STRING_DEFAULT_EMPTY(NYUserManager.user_id)}];
    
    [request paramInsert:questionString forKey:@"question"];
    [request startWithSuccess:^(__kindof BaseRequest * _Nonnull request, __kindof id  _Nonnull data) {
        
        [NYTipClass showText:@"提交成功，请耐心等待老师给您回复"];
        [self.controller loadData];
    } failed:^(__kindof BaseRequest * _Nonnull request, NSError * _Nonnull error) {
        
    }];

}
@end
